package indi.dos;

import static org.junit.jupiter.api.Assertions.*;

import java.util.ArrayList;
import java.util.Scanner;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import indi.entity.Card;
import indi.service.CardService;

class TestCardService {

	
	@BeforeAll
	static void setUpBeforeClass() throws Exception {
	}

	@AfterAll
	 void tearDownAfterClass() throws Exception {
//		System.out.println("删除后");
//		cs.outputCards(cards);
	}

	@Test
	void test() {
		
		CardService cs = new CardService();
		ArrayList<Card> cards = new ArrayList<>();
		
		System.out.println("测试开始");
		cs.makeACard("合肥", "计算机专业");
		cs.makeACard("武汉", "光学专业");
		cs.makeACard("北京", "化学专业");
		cs.makeACard("上海", "园林专业");
		
		cards = cs.getCurrentCards();
		// 判断
		assertEquals(4, cards.size());
		System.out.println("添加后");
		cs.outputCards(cards);
		
		while(true) {
			System.out.println("输入删除选项：");
			Scanner s = new Scanner(System.in);
			int id = s.nextInt();
			cs.deleteCard(id);
			
			if(id == -1) {
				break;
			}
		}
		System.out.println("测试结束");
	}
}
